🐍 Python Programming – Pre-Assessment Knowledge Organiser

Spring 1 – Lesson 5: Consolidation

1️⃣ Inputs, Outputs & Variables

πŸ”‘ Key Ideas

🧠 Key Syntax

name = input("Enter your name: ")
print(name)

πŸ”„ Casting (Changing Data Type)

num = int(input("Enter a number: "))
print(num * 2)

⚠️ Common Mistakes

2️⃣ Selection (IF / ELIF / ELSE)

πŸ”‘ Key Ideas

🧠 IF / ELSE

if answer.lower() == "warsaw":
    print("Correct")
else:
    print("Incorrect")

🧠 IF / ELIF / ELSE

if colour.lower() == "red":
    print("Correct")
elif colour.lower() == "blue":
    print("Correct")
elif colour.lower() == "yellow":
    print("Correct")
else:
    print("Incorrect")

⚠️ Common Mistakes

3️⃣ While Loops

πŸ”‘ Key Ideas

🧠 Conditional While Loop

while password != "Secret123":
    print("Incorrect password")
    password = input("Try again: ")

🧠 while True with break

while True:
    guess = input("Enter a colour: ")
    if guess.lower() == "red":
        print("Correct")
        break
    else:
        print("Incorrect")

⚠️ Common Mistakes

4️⃣ For Loops

πŸ”‘ Key Ideas

🧠 For Loop Example

for i in range(1, 13):
    print(f"{i} x 8 = {i * 8}")

⚠️ Common Mistakes

5️⃣ Lists (1D Lists)

πŸ”‘ Key Ideas

🧠 Example List

sports = ["Shotput", "Javelin", "Discus"]

🧠 Looping Through a List

for i in range(0, len(sports)):
    print(sports[i])

⚠️ Common Mistakes

6️⃣ 2D Lists (Lists of Lists)

πŸ”‘ Key Ideas

🧠 Accessing Data

landmarks[i][0]   # Name
landmarks[i][1]   # Location

🧠 Looping Through a 2D List

for i in range(0, 8):
    print(f"{landmarks[i][0]} is in {landmarks[i][1]}")

πŸ” Searching a 2D List

search = input("Enter medal type: ")

for i in range(0, 8):
    if medals[i][1] == search.lower():
        print(f"{medals[i][0]} won {medals[i][1]}")

⚠️ Common Mistakes

πŸ§ͺ Exam Tips